package jwj8508;

public class J28_PrinterInterface {

	// 인터페이스를 사용하지 않은 경우
	// 예) 프린터 제조사

	public static void main(String[] args) {
		HPPrinter h = new HPPrinter();
		h.speedPrint();
		CannonPrinter c = new CannonPrinter();
		c.hyperPrint();
		EpsonPrinter e = new EpsonPrinter();
		e.nanoPrint();
		
		HPPrinterDriver hd = new HPPrinterDriver();
		hd.print();
		CannonPrinterDriver cd = new CannonPrinterDriver();
		cd.print();
		EpsonPrinterDriver ed = new EpsonPrinterDriver();
		ed.print();
		
		// 인터페이스를 이용한 다형성
		Printable p = new HPPrinterDriver();
		p.print();
		p = new CannonPrinterDriver();
		p.print();
		p = new EpsonPrinterDriver();
		p.print();

	}

}

class HPPrinter {
	public void speedPrint() {
		System.out.println("빠름 빠름 빠름. - HP");
	}
}

class CannonPrinter {
	public void hyperPrint() {
		System.out.println("더 빠름 더 빠름 더 빠름. - Cannon");
	}
}

class EpsonPrinter {
	public void nanoPrint() {
		System.out.println("더더 빠름 더더 빠름 더더 빠름. - Epson");
	}
}

interface Printable {
	public void print();
	
}

class HPPrinterDriver implements Printable {
	@Override
	public void print() {
		System.out.println("빠름 빠름 빠름. - HP");
	}
}

class CannonPrinterDriver implements Printable {
	@Override
	public void print(){
		System.out.println("더 빠름 더 빠름 더 빠름. - Cannon");
	}
}

class EpsonPrinterDriver implements Printable {
	@Override
	public void print(){
		System.out.println("더더 빠름 더더 빠름 더더 빠름. - Epson");
	}
}





